      1  import java.io.IOException;

      2  import javax.swing.JFrame;

      3  import javax.swing.JOptionPane;

      4

      5  /**

      6     A graphical simulation of an automatic teller machine.

      7  */

      8  public class ATMViewer

      9  {

     10     public static void main(String[] args)

     11     {

     12        ATM theATM;

     13

     14        try

     15        {

     16           Bank theBank = new Bank();

     17           theBank.readCustomers("customers.txt");

     18           theATM = new ATM(theBank);

     19        }

     20        catch(IOException e)

     21        {

     22           JOptionPane.showMessageDialog(null, "Error opening accounts file.");

     23           return;

     24        }

     25

     26        JFrame frame = new ATMFrame(theATM);

     27        frame.setTitle("First National Bank of Java");

     28        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

     29        frame.setVisible(true);

     30     }

     31  }

     32